package com.zkingsoft.zkingbase.gen;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import org.greenrobot.greendao.database.Database;

/**
 * Created by ytf on 2017/2/28.
 * Description:
 */

public class CustomDevOpenHelper extends DaoMaster.DevOpenHelper
{
    @Override
    public void onCreate(Database db)
    {
        //如果存在相同的表则不会再创建
        DaoMaster.createAllTables(db, true);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
        DaoMaster.dropAllTables(db, false);
        onCreate(db);
    }

    public CustomDevOpenHelper(Context context, String name)
    {
        super(context, name);
    }

    public CustomDevOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

}
